package io.hots.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hots.controller.request.ScanCodeRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * @author yueshibin@cetcbigdata.com
 * @date 2022/6/8 8:14 下午
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("scan_code")
public class ScanCodeEntity implements Serializable{

    private static final long serialVersionUID = 1L;

    private Long id;

    /**
     * 用户编号
     */
    private String userId;

    /**
     * 姓名
     */
    private String name;

    /**
     * 场所码
     */
    private String venueId;

    /**
     * 场所名称
     */
    private String venueName;

    /**
     * 创建时间
     */
    private Date createTime;

    public ScanCodeEntity(UserEntity o, VenueEntity v) {
        this.userId = o.getUserId();
        this.name = o.getName();
        this.venueId = v.getVenueId();
        this.venueName = v.getVenueName();
        this.createTime = new Date();
    }

    public ScanCodeEntity(ScanCodeRequest o) {
        this.userId = o.getUserId();
        this.name = "";
        this.venueId = o.getVenueId();
        this.venueName = "";
        this.createTime = new Date();
    }
}
